package com.wt.admin.util;


import com.wt.admin.config.SpringContextHolder;
import com.wt.admin.config.prop.IndexProp;

public class FileUtils {

    public static String getImageAbsURL(String uri){
        IndexProp indexProp = SpringContextHolder.getBean("indexProp");
        String savePath = indexProp.getFiles().getSavePath();
        return uri.replace("/file/", savePath);
    }

    public static String newImageAbsURL(String oldUri){
        // 对 replace 文件路径生成新的名字
        String newUrl = oldUri.substring(0, oldUri.lastIndexOf(".")) + "_" + System.currentTimeMillis()
                + oldUri.substring(oldUri.lastIndexOf("."));
        return newUrl;
    }



}
